package public

import (
	"crypto/md5"
	"fmt"
	"github.com/anaskhan96/go-password-encoder"
)

/*// 密码加密   返回盐值和密文密码
func SaltPassword(psw string) (string, string) {
	options := &password.Options{10, 10000, 50, md5.New}
	//盐值加密
	salt, encodedPwd := password.Encode(psw, options)

	return salt, encodedPwd
}*/

// 验证密码
func CheckPassword(salt, psw, saltpsw string) bool {
	options := &password.Options{10, 10000, 50, md5.New}
	check := password.Verify(psw, salt, saltpsw, options)
	fmt.Println(check) // true
	return check
}
